package
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.geom.Point;

	public class Escalator
	{
		public var display:Sprite = new Sprite();
		public var m_location:Point = new Point();
		public var flipped:Boolean = false;
		
		public function Escalator()
		{
			var escalator:DisplayObject = ImageManager.getImage('assets/escalator.png');
			escalator.y = -68;
			
			escalator.x = display.width/2 - 8;			
			display.addChild(escalator);
		}
		
		public function flip():void{
			flipped = !flipped;
			display.scaleX = (flipped) ? -1 : 1;
		}
		
		public function get topLocation():Point{
			return m_location.add(new Point(1,1));
		}
		
		public function get location():Point{
			return m_location;
		}
		
		public function set location(newLocation:Point):void{
			m_location = newLocation;
			display.x = m_location.x * Game.PPS;
			display.y = -m_location.y * Game.PPS;
		}
		
		public function get bottomPoint():Point{
			return m_location.clone();
		}
		
		public function get topPoint():Point{
			return m_location.add(new Point(.8,1));
		}
	}
}